﻿Imports DTO
Imports System.Data.OleDb

Public Class PhieuThueDao
    Public Function LayDanhSach() As List(Of PhieuThueDto)
        Dim ds As New List(Of PhieuThueDto)
        Dim cn As OleDbConnection
        Dim strSQL As String
        'B1 & B2: Tao chuoi ket noi, mo ket noi bang doi tuong ket noi
        cn = DataProvider.ConnectDB()
        'B3: Tao chuoi strSQL thao tac CSDL
        strSQL = "Select MaPhieuThue From PHIEUTHUEPHONG"
        'B4: Thuc thi chuoi strSQL
        cn.Open()
        Dim cmd As New OleDbCommand(strSQL, cn)
        Dim dr As OleDbDataReader
        dr = cmd.ExecuteReader()
        Dim pt As New PhieuThueDto()
        While (dr.Read())
            pt = New PhieuThueDto()
            pt.MaPhieuThue = dr("MaPhieuThue")
            ' pt.MaPhong = dr("MaPhong")
            'pt.NgayBatDauThue = dr("NgayBatDauThue")

            ds.Add(pt)

        End While
        'B5: Dong ket noi CSDL
        cn.Close()
        Return ds
    End Function
End Class
